using System;
using Provausio.Common.Objects;
using TrainingManagement.api.Models.Data.CRUD;
using TrainingManagement.api.Models.Data.CRUD.Location;

namespace TrainingManagement.api.Models.BusinessLogic.Location
{
    public class LocationUpdateOperation : BusinessOperation<BusinessObjects.Location, bool>
    {
        readonly LocationUpdateDataSource _locationUpdate = new LocationUpdateDataSource();

        public override bool Run(BusinessObjects.Location input)
        {
            if (_locationUpdate.Execute(input))
                return true;
            throw new Exception("{0} failed to update!");
        }
    }
}